<!--
 * @Descripttion: 
 * @version: 
 * @Author: ybac
 * @Date: 2022-06-20 11:13:15
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-08-04 14:15:43
-->
 
<template>
  <div>
    <crumbs @goBack="() => {
        $router.go(-1)
      }
      " :superiorMenu="['计划管理']" currentMenu="生产订单" style="margin-bottom: 12px" />
    <a-card :bordered="false" size="small">
      <a-tabs v-model="tab" @change="callback">
        <!-- <a-tab-pane key="0" :tab="`待派发(${numa})`"></a-tab-pane>
        <a-tab-pane key="1" :tab="`已派发(${numb})`"></a-tab-pane> -->
        <a-tab-pane v-for="(item,index) in list" :key="index" :tab="item.title">
        </a-tab-pane>

      </a-tabs>
      <ClientForm :formType="formType"  ref="waitLis"></ClientForm>
      <!-- <waitLis ref="waitLis" v-show="tab == 0" @changeNum="changeNum" />
      <alreadyList ref="alreadyList" v-show="tab == 1" @changeNum="changeNum" /> -->
    </a-card>
  </div>
</template>
<script>
import crumbs from '@/components/crumbs.vue'
import waitLis from '@/views/planManage/proOrder/modules/waitLis'
import alreadyList from '@/views/planManage/proOrder/modules/alreadyList'
import ClientForm from '@/views/planManage/components/ClientForm'
import { getFormTypeDict } from '@/api/productOrder'

export default {
  components: { crumbs, waitLis, alreadyList,ClientForm },
  data () {
    return {
      tab: 0,
      formType: '1',

      numa: '',
      numb: '',
      list: [
      ]
    }
  },
  created () { 
    getFormTypeDict().then(res=>{
      if(res.code == 200){
        this.list = res.result
        this.formType = this.list[0].value
        this.$refs.waitLis.requestData()
      }else{
        this.$message.error(res.message)
      }
      console.log(res,'2222222222')
    })
  },
  methods: {
    callback (e) {
      console.log(e)
      this.formType = this.list[e].value
      console.log(this.formType)
     this.$nextTick(()=>{
      this.$refs.waitLis.requestData()
     })
    },
    changeNum (v, url) {
      if (url == '/planmgt/erpProductOrder/list?status=0') {
        this.numa = v
      } else {
        this.numb = v
      }
    },
  },
}
</script>
<style lang="less" scoped>
  /deep/ .ant-card-body {
    height: calc(100vh - 180px);
    overflow: hidden;
    padding: 0 16px 20px 16px ;
  }
</style>